package SevenWeek;

import java.util.Scanner;
import java.util.Queue;
import java.util.ArrayDeque;

public class fivesix {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		while (n < 0 || n > 1000)
			n = input.nextInt();
		Integer[] Number = new Integer[n];
		for (int i = 0; i < n; i++) {
			Number[i] = new Integer(input.nextInt());
		}
		Queue<Integer> Queue1 = new ArrayDeque<Integer>();
		Queue<Integer> Queue2 = new ArrayDeque<Integer>();
		for (int i = 0; i < n; i++) {
			if (Queue1.size() == 2) {
				System.out.printf(Queue1.poll() + " " + Queue1.poll() + " ");
				if (Queue2.size() >= 1)
					System.out.printf(Queue2.poll() + " ");
			}
			if (Number[i] % 2 == 1)
				Queue1.add(Number[i]);
			else
				Queue2.add(Number[i]);
		}
		while (Queue1.size() > 1)
			System.out.printf(Queue1.poll() + " ");
		if(Queue1.size()==1){
			System.out.println(Queue1.poll());
		}

		while (Queue2.size() > 1)
			System.out.printf(Queue2.poll() + " ");
		if(Queue2.size()==1){
			System.out.println(Queue2.poll());
		}

	}

}